<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/prettyphoto.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.mselect.js?"></script>
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.prettyphoto.js"></script>
<script type="text/javascript">
$(function(){
	var product_categories_data = <?=$product_categories?>;
	$(document).mselect(product_categories_data, 'product_categories_id', 'product_categories_id', "<?=isset($_GET['product_categories_id']) ? $_GET['product_categories_id'] : 0?>");
	$("a[rel^='pretty_photo']").prettyPhoto({theme:'facebook'});
	$(".detail").colorbox({width:"1000px", maxWidth:"95%", height:"70%", iframe:true});
});
</script>

<fieldset><legend>查询条件</legend>
<form method="get" action="">
<?include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table">
<tr>
	<th>产品编号</th>
	<td>
		<input type="text" name="start_number" value="<?=isset($_GET['start_number']) ? $_GET['start_number'] : ''?>" /> to 
		<input type="text" name="end_number" value="<?=isset($_GET['end_number']) ? $_GET['end_number'] : ''?>" /> 填写后六位，例如：000001
	</td>
</tr>
<tr>
	<th>多个SKU</th>
	<td colspan="3"><input type="text" name="product_numbers" value="<?=isset($_GET['product_numbers']) ? $_GET['product_numbers'] : ''?>" size="70" /></td>
</tr>
<tr>
	<th>选择分类</th>
	<td><input type="hidden" id="product_categories_id" name="product_categories_id" /></td>
</tr>
<tr>
	<td></td>
	<td><input type="submit" value="查询" class="button" /></td>
</tr>
</table>
</form></fieldset>

<table class="list_table" style="table-layout: fixed;" width="98%" id="list">
<tr>
	<th width="40">
		<a href= "<?=$url?>&sort_by=<?='storage_number'?>&sort_order=<?=(isset($_GET['sort_by']) && ($_GET['sort_by'] == 'storage_number') && ($_GET['sort_order'] == 'desc')) ? 'asc' : 'desc'?>">SKU</a>
		<?=(isset($_GET['sort_by']) && $_GET['sort_by'] == 'storage_number') ? ($_GET['sort_order'] == 'asc' ? '↑' : '↓') : ''?>
	</th>
	<th width="120">产品名称</th>
	<th width="50">
		<a href="<?=$url?>&sort_by=<?='product_warehouse.weekly_sales'?>&sort_order=<?=(isset($_GET['sort_by']) && ($_GET['sort_by'] == 'product_warehouse.weekly_sales') && ($_GET['sort_order'] == 'desc')) ? 'asc' : 'desc'?>" >周销</a>
		<?=(isset($_GET['sort_by']) && $_GET['sort_by'] == 'product_warehouse.weekly_sales') ? ($_GET['sort_order'] == 'asc' ? '↑' : '↓') : ''?>
	</th>
	<th width="50">
		<a href="<?=$url?>&sort_by=<?='product_warehouse.monthly_sales'?>&sort_order=<?=(isset($_GET['sort_by']) && ($_GET['sort_by'] == 'product_warehouse.monthly_sales') && ($_GET['sort_order'] == 'desc')) ? 'asc' : 'desc'?>" >月销</a>
		<?=(isset($_GET['sort_by']) && $_GET['sort_by'] == 'product_warehouse.monthly_sales') ? ($_GET['sort_order'] == 'asc' ? '↑' : '↓') : ''?>
	</th>
	<th width="50">销售状态</th>
	<th width="50">采购状态</th>
	<th width="60">店铺数量</th>
	<th width="70">查看各店铺上架情况</th>
</tr>
<?foreach ($item as $i):?>
<tr>
	<td>
		<?if ($i['pic_url']):?>
			<?$pretty_photo_number = 0;?>
			<?foreach ($i['pic_url'] as $ip):?>
			<a rel="pretty_photo[<?=$i['id']?>]" href="<?=$ip?>"><?if(!$pretty_photo_number):?><span class="img_icon"></span><?endif;?></a>
			<?$pretty_photo_number = 1;?>
			<?endforeach;?>
		<?endif;?>	
		<?=$i['number']?>
	</td>
	<td align="left"><?=$i['product_name']?></td>
	<td><?=$i['weekly_sales']?></td>
	<td><?=$i['monthly_sales']?></td>
	<td><font color="#<?=Helper_BSS_Normal::getIniOne('product_sales_status', 'value', $i['sales_status'], 'color')?>"><?if (isset($i['sales_status'])): ?><?=Helper_BSS_Normal::getIniOne('product_sales_status', 'value', $i['sales_status'], 'name') ?><?endif;?></font></td>
	<td><font color="#<?=Helper_BSS_Normal::getIniOne('product_purchase_status', 'value', $i['purchase_status'], 'color')?>"><?if (isset($i['purchase_status'])): ?><?=Helper_BSS_Normal::getIniOne('product_purchase_status', 'value', $i['purchase_status'], 'name') ?><?endif;?></font></td>
	<td><?=$i['shop_count']?></td>
	<td><a class="detail" href="<?=url('Online::EbayListing/ProductTraceDetail', array('id'=>$i['product_basic_id']))?>">查看</a></td>
</tr>
<?endforeach;?>
</table>
<?=$page?>
<table class="list_table">
<tr>
	<td>
		<a href="<?=url('Online::EbayListing/ProductTraceListExport', array('url_arr' => $url_arr))?>">
		<input type="button" value="导出列表" class="button" />
		</a>
	</td>
	</tr>
</table>
<?php $this->_endblock();?>